@semantic-release/error
Error type used by all semantic-release packages.
![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/error.svg)
Errors of type SemanticReleaseError
or an inherited type will be considered by semantic-release as an expected exception case (no release to be done, running on a PR etc..). That indicate to the semantic-release
process to stop and exit with the 0
success code.
Any other type of error will be considered by semantic-release as an unexpected error (i/o issue, code problem etc...). That indicate to the semantic-release
process to stop, log the error and exit with the 1
failure code.
Usage
const SemanticReleaseError = require('@semantic-release/error');
throw new SemanticReleaseError();
throw new SemanticReleaseError('An error happened');
throw new SemanticReleaseError('An error happened', 'ECODE');
throw new SemanticReleaseError('An error happened', 'ECODE', 'Here is some suggestions to solve this error.');
class InheritedError extends SemanticReleaseError {
constructor(message, code, newProperty, details) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.code = code;
this.details = details;
this.newProperty = 'newProperty';
}
}
throw new InheritedError('An error happened', 'ECODE', 'Here is some suggestions to solve this error.');